home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 June / MACPOWER-1997-06.ISO.7z / MACPOWER-1997-06.ISO / MacPowerオリジナル / SHOCKWAVE RIDER! / XtraNetリファレンス < prev    next >
Text File  |  1996-04-18  |  76KB  |  1,729 lines

  1. XtraNet v1.02
  2. Documentation
  3. copyright ゥ 1996-97 by g/matter, inc.
  4. Written by Terry R. Schussler 
  5. Table of Contents
  6. Table of Contents    1
  7. Overview of XtraNet    1
  8. The Four Types of Xtras    1
  9. What is a Sprite Xtra?    1
  10. What is a Lingo Xtra?    1
  11. What is a Transition Xtra?    1
  12. What is a Tool Xtra?    1
  13. Version History    1
  14. 1.0    1
  15. 1.01    1
  16. 1.02    1
  17. XtraNet Installation and End-user Delivery    1
  18. How To Install XtraNet with Director    1
  19. How To Install XtraNet with Shockwave    1
  20. Shipping XtraNet with a Runtime Projector    1
  21. Deliverying XtraNet via Shockwave    1
  22. Getting Started with XtraNet    1
  23. Using the Xtras Menu    1
  24. Using Lingo    1
  25. Registering XtraNet    1
  26. Using an Unregistered Copy of XtraNet    1
  27. The XtraNet Lingo Interface    1
  28. Overview    1
  29. Standard Lingo Xtra Functions/Commands    1
  30. interface(xtra "XtraNet") -or- mMessageList(xtra "XtraNet")    1
  31. General    1
  32. XNetInit    1
  33. XNetIdle    1
  34. XNetClose integer cookieID    1
  35. XNetShutdown    1
  36. XNetSetProxy string hostName, integer portAddress    1
  37. Informational    1
  38. XNetVersion()    1
  39. XNetIPAddress()    1
  40. XNetPort(integer cookieID)    1
  41. XNetDNSLookup(string hostname|string IPaddress)    1
  42. XNetError(integer errorCode)    1
  43. XNetSetConnectionLoc point upperLeftCornerofDialog    1
  44. XNetSetConnectionMsg string dialogText    1
  45. Operation Timing    1
  46. XNetSetDefaultTimeout integer timeOut    1
  47. XNetGetDefaultTimeout    1
  48. XNetSetTimeout integer cookie, integer timeOut    1
  49. XNetGetTimeout integer cookie    1
  50. Netscape-style Cookies    1
  51. XNetSetCookie string cookie    1
  52. XNetClearCookie    1
  53. HTTP/FTP Access    1
  54. XNetGetFile string url, string filename, string callback    1
  55. XNetGetGlobal string url, string globalname, string callback    1
  56. XNetPutFile string filename, string url, string callback    1
  57. XNetPutGlobal string globalname, string url, string callback    1
  58. Peer Class    1
  59. XNetPeerCreate    1
  60. XNetPeerConnect integer cookieID, string remoteHost, integer port    1
  61. XNetPeerAccept integer cookieID, integer port    1
  62. XNetPeerGet integer cookieID    1
  63. XNetPeerSend integer cookieID, string theText    1
  64. Client Class    1
  65. XNetClientCreate    1
  66. XNetClientConnect integer cookieID, string remoteHost, integer port    1
  67. XNetClientAccept integer cookieID, integer port    1
  68. XNetClientGet integer cookieID    1
  69. XNetClientSend integer cookieID, string theText    1
  70. Server Class    1
  71. XNetServerStart integer maxClients, integer port, string callback    1
  72. XNetServerSend integer cookieID, string theText [, string clientName]    1
  73. XNetServerDisconnect integer cookieID, string clientName    1
  74. Raw Class    1
  75. XNetRawCreate    1
  76. XNetRawConnect integer cookie, string remoteHost, integer port    1
  77. XNetRawAccept integer cookie, integer port    1
  78. XNetRawGet integer cookie    1
  79. XNetRawSend integer cookie, string theText    1
  80. XtraNet's CallBack Mechanism    1
  81. The Callback Parameter    1
  82. Creating a Callback Handler    1
  83. Structure of Callback Handler Data    1
  84. Cookie    1
  85. Major Code    1
  86. Minor Code    1
  87. Optional Error Code    1
  88. HTTP Code    1
  89. Callback Data Debugging    1
  90. Optimizing XtraNet Performance    1
  91. Controlling Idle Time    1
  92. Using Director's Idle Time Properties    1
  93. the frameTempo -or- Tempo Channel    1
  94. the cpuHogTicks    1
  95. the idleHandlerPeriod    1
  96. the idleLoadMode    1
  97. the idleLoadPeriod    1
  98. the idleReadChunkSize    1
  99. Sustaining Connections    1
  100. Credits    1
  101. Human Code, Inc.    1
  102. g/matter, inc.    1
  103. Other g/matter Products    1
  104. PrintOMatic Xtra    1
  105. PopMenu Xtra    1
  106. Sound Xtra    1
  107. KILLER Transitions    1
  108. Trans-X Xtra    1
  109. Director ToolBox Pro    1
  110. The MediaBook CD for Director    1
  111. How To Contact Us    1
  112. Copyright Notices    1
  113. Appendix A - Error Messages and Codes    1
  114. Appendix B - Memory Overhead Chart    1
  115. Macintosh 68K    1
  116. Macintosh PPC    1
  117. Windows 16-bit    1
  118. Windows 32-bit    1
  119. Appendix C - Shockwave Security Issues    1
  120. ISO Compliant Filenames    1
  121. Invalid Filename Extensions    1
  122. Appendix D - FTP Connection Process in XtraNet    1
  123. Appendix E - Additional References and Resources    1
  124. WWW Resources    1
  125. WWW References    1
  126. Book References    1
  127. "Internet Protocols Handbook"    1
  128. Appendix F - URL Encoding    1
  129. Example #1    1
  130. Example #2    1
  131.  
  132.  
  133. Overview of XtraNet
  134. XtraNet allows you to add powerful Internet and intranet connectivity to your Macromedia Director 
  135. productions.  For Internet access, XtraNet provides a series of access classes including Server, Client, Peer 
  136. and Raw. XtraNet also provides direct access to HTTP, FTP and other Internet protocols.  The Raw class 
  137. allows you to create support for custom or special Internet protocols.  As an example, a simple SMTP mail 
  138. application is provided as a sample XtraNet file.
  139.  
  140. For intranets, XtraNet provides a powerful LAN based multiuser connectivity solution.
  141.  
  142. You can build a tremendous number of new applications which before now were impossible.  Multi-player 
  143. games, dynamic advertising, multi-user chat systems, incremental news servers, the list of uses is endless.
  144. The Four Types of Xtras
  145. Director 5.0 introduced support for a new type of plug-in which is known as an Xtra.  Xtras are available in 
  146. four different types: Sprite, Lingo, Transition and Tool.  XtraNet is a Lingo Xtra.
  147. What is a Sprite Xtra?
  148. A Sprite Xtra (or an Asset Xtra as it is sometimes referred to) adds additional functionality to Director through 
  149. the introduction of custom castmember types which subsequently can be used to add new types of sprites to 
  150. your multimedia production's stage.
  151. What is a Lingo Xtra?
  152. A Lingo Xtra adds functionality to Director through the introduction of new commands and functions which 
  153. can be accessed through Lingo.  Lingo Xtras are very similar to XObjects in the way that they add 
  154. functionality to Director.
  155. What is a Transition Xtra?
  156. A Transition Xtra adds new visual effects functionality to Director to enhance the display of new multimedia 
  157. elements in a project.
  158. What is a Tool Xtra?
  159. A Tool Xtra adds new functionality to Director through the Xtras menu.  Tool Xtras can be written using 
  160. MOA compliant C or C++ code or you can build a Tool Xtra using Director itself and implementing a movie in 
  161. a window which is accessed from the Xtras menu.
  162. Version History
  163. 1.0
  164. Released 10/16/96
  165. First public release.
  166. 1.01
  167. Released 10/31/96
  168. Due to an unfortunate error in the compiled code, the 1.01 release was created to eliminate a timeout that was 
  169. in the 1.0 version.  If you have the 1.0 version you are strongly requested to replace it with the 1.01 release.
  170. 1.02
  171. Released 3/1/97
  172. This release adds support for proxy servers using the XNetSetProxy command.
  173. XtraNet Installation and End-user Delivery
  174. How To Install XtraNet with Director
  175.  
  176. When Director launches, it automatically locates Xtras by looking in two special places:
  177.  
  178. Macintosh
  179. Location #1:    The Xtras folder which is in the same location as your Director application.
  180. Location #2:    The Macromedia:Xtras folder contained in your System folder.
  181.  
  182. Windows
  183. Location #1:    The Xtras subdirectory which is in the same location as your Director application.
  184. Location #2:    The Windows・Macromed・Xtras subdirectory on Windows 3.1  -OR- The Program 
  185. Files・Common Files・Macromedia・Xtras subdirectory on Windows 95 or Windows NT
  186.  
  187. To make XtraNet available to your copy of Director, you simply need to run the XtraNet Installer contained on 
  188. the XtraNet CD.  Check the XtraNet Read Me file for any late breaking installation news.
  189.  
  190. Macintosh
  191. Launch the application titled "XtraNet™ Installer" located in the root of the XtraNet CD-ROM.
  192.  
  193. Windows
  194. Launch the application titled "SETUP.EXE" located in the root of the XtraNet CD-ROM.
  195.  
  196. How To Install XtraNet with Shockwave
  197.  
  198. When a Shockwave for Director plug-in launches, it automatically locates Xtras by looking in a special 
  199. "support" folder.  This folder must be located in one of the following places:
  200.  
  201. Macintosh (All browsers)
  202. 68K:        The NP-68K-Dir-Shockwave Folder folder contained in your browser's "plug-in" folder.
  203. PowerPC:    The NP-PPC-Dir-Shockwave Folder folder contained in your browser's "plug-in" folder.
  204.  
  205. Windows (Netscape Navigator compatible plug-in)
  206. 3.1:        The NP16DSW directory contained in your browser's "plug-in" directory.
  207. 95/NT:        The NP32DSW directory contained in your browser's "plug-in" directory.
  208.  
  209. Windows (Microsoft ActiveX control)
  210. 3.1:        The WINDOWS・SYSTEM directory.
  211. 95/NT:        The WINDOWS・SYSTEM directory.
  212.  
  213. To make XtraNet available to your browsers, you run the XtraNet Installer as described above - once for each 
  214. platform.
  215.  
  216.  
  217. Shipping XtraNet with a Runtime Projector
  218.  
  219. XtraNet can be shipped as part of a Director multimedia project.  To do this, you simply need to copy the 
  220. XtraNet Xtra that you are using in your project into a special folder/subdirectory named Xtras.  Then you 
  221. must place this Xtras folder/subdirectory in the same place as your runtime projector application.
  222.  
  223. If you deliver your project on a CD-ROM, you do not need to install XtraNet onto the user's hard disk unless 
  224. you require that the user start your program by running the Director runtime projector from the hard disk.  If 
  225. you require this, it is recommended that you create a complete installer for your project which performs the 
  226. following:
  227.  
  228. * Creates any required program groups or folders
  229. * Checks for the existence of TCP/IP software and if not installed, installs it for the user
  230. * Copies the Director runtime projector for your project to the hard disk
  231. * Copies all Director Xtras for your project (including XtraNet) to the hard disk
  232.  
  233. If you are delivering your content on CD-ROM, but execute it through a Shockwave-compatible browser you 
  234. will want your installer to place the XtraNet software into the Shockwave support folder (as described above.)
  235.  
  236. IMPORTANT NOTE:  YOU MAY NOT DISTRIBUTE YOUR XTRANET SERIAL NUMBER in any 
  237. human readable form with your project.  The XtraNet serial number is not redistributable under the licensing 
  238. agreement that accompanies this software and is a copyright violation.
  239.  
  240. Refer to your Director manual for more detailed instructions on the proper use and delivery of Xtras with your 
  241. Director projects.
  242. Deliverying XtraNet via Shockwave
  243.  
  244. If you wish to have a user access a webpage and immediately display an interactive multimedia presentation 
  245. (ostensibly delivered via Shockwave) which also has multiuser and client/server functionality, you do need to 
  246. install (as mentioned above) the XtraNet software into the user's Shockwave support folder.  This installation 
  247. process can be partially automated through Shockwave and/or other internet protocols, but not completely.  
  248. The reason for this is security.  If webpages were able to automatically place files on the user's harddisk 
  249. indiscriminately, we would be exposing users to serious potential for "vandalism" by unscrupulous people.  
  250. To avoid this potential, the user *must* be the arbitrator of the actual placement of the downloaded software 
  251. into a location which will enable it to function.  This protects both the user and the provider of the software.
  252.  
  253. Here is some simple Lingo code which you can use to determine if XtraNet is installed and if not, direct the user 
  254. to an HTML document which provides download access and installation instructions.  This code would need 
  255. to be running in a Shockwave movie to function properly:
  256.  
  257. on isXtraNetInstalled
  258.   put the number of xtras into xtraCount
  259.   repeat with theXtraNum = 1 to xtraCount
  260.     if the name of xtra theXtraNum contains "XtraNet" then return TRUE
  261.   end repeat
  262.   return FALSE
  263. end isXtraNetInstalled
  264.  
  265. on checkForXtraNet
  266.   if isXtraNetInstalled() = FALSE then
  267.     gotoNetPage "http://www.yoursite.com/getXtraNet.html"
  268.   end if
  269. end checkForXtraNet
  270.  
  271. Getting Started with XtraNet
  272. Using the Xtras Menu
  273. The Tools menu contains an XtraNet item when XtraNet has been properly installed into the Xtras folder.  
  274. The XtraNet menu command contains two choices:
  275.  
  276. About XtraNet...
  277. XtraNet Help
  278.  
  279. About XtraNet...
  280.  
  281. This command will open up a Director movie in a window which identifies the creators of XtraNet and provides 
  282. other credits information.  It also contains a special "Check XtraNet Version" button which will compare 
  283. your currently installed version of XtraNet against the current release as identified by our server.  This feature 
  284. requires you have an active connection to the Internet through TCP/IP and that our server is available.
  285.  
  286. XtraNet Help
  287.  
  288. This is a help file which contains online documentation for XtraNet in a searchable handy reference which you 
  289. can access while authoring in Director.  It uses the same help engine as Macromedia Director itself so it is easy 
  290. to use!
  291. Using Lingo
  292. You can determine if XtraNet was successfully loaded when you launched Director by using the "showXlib" 
  293. Lingo command in the Message window:
  294.  
  295. showXlib
  296. -- XLibraries:
  297. --   Xtra: FileFlex
  298. --   Xtra: XtraNet
  299. --   Xtra: PrintOMatic_Lite
  300. -- "*Standard.xlib"
  301. --   XObject: FileIO           Id:1020 
  302. --   XObject: SerialPort       Id:200  
  303. --   XObject: XCMDGlue         Id:2020 
  304. Registering XtraNet
  305. You must apply your serial number to XtraNet using the XNetInit command before distributing XtraNet with 
  306. your projects.  If you enter a valid serial number (usually located on the back of your CD-ROM jewel case) as 
  307. an argument to the XNetInit command, you will have successfully registered your copy of XtraNet and 
  308. activated all of its features.
  309. Using an Unregistered Copy of XtraNet
  310. If you don't apply your serial number as described above, you will be reminded that you are using an 
  311. unregistered version everytime you use the XNetInit command.
  312.  
  313. Also, using an unregistered version of XtraNet will result in the informational alert dialog appearing every 5 
  314. minutes during an XtraNet session.
  315.  
  316. Finally, two features of XtraNet are disabled when running an unregistered version of XtraNet.  The features 
  317. are the XNetSetConnectionLoc and XNetSetConnectionMsg commands.
  318.  
  319. The XtraNet Lingo Interface
  320. Overview
  321. XtraNet's features are accessing using Director's Lingo programming language.  This documentation 
  322. assumes that the reader has familiarity with the basic functions and commands provided in Lingo.  Below is a 
  323. completion description of each of the Lingo commands and functions provided by XtraNet.
  324.  
  325. What is a Function?
  326. A function is a mechanism which you use in your code to evaluate an expression and return a calculated 
  327. result.  You will usually pass arguments to a function although sometimes a function will not require 
  328. them.  You will always expect to get data returned by a function.  The data will usually represent the 
  329. result of evaluating the data passed as arguments to the function itself when it was initially called.
  330. To get a function to perform its work and return a result, you need to surround the argument(s) with a 
  331. set of parenthesis.  Even if the function requires or accepts no arguments, you still need to use the 
  332. parenthesis to get Director to return the function value.  You can also use the special keyword "the 
  333. result" to get the last function result calculated.
  334. Examples:
  335. put myFunction(myData) into calculationResult
  336. put myFunction(myExpression) into calculationResult
  337. put myStaticFunction() into functionResult
  338.  
  339. myFunction(myData)
  340. put the result into calculationResult
  341.  
  342. Using functions over properties has an advantage in that functions all return error codes with a zero 
  343. indicating no error.
  344. What is a Command?
  345. A command is a mechanism which you use in your code to perform a specific task.  You may pass a 
  346. command optional arguments.  Generally, you do not expect to get any data returned by a command.  
  347. If you do, the data will usually be a code which represents the success or failure of the command itself 
  348. in completing its assigned task.
  349. Examples:
  350. executeMyCommand
  351. executeMyCommand myData
  352. put executeMyCommand(myData) into successResult
  353.  
  354. Practically every one of the XtraNet commands returns a status code: 0 for success, and some 
  355. negative number for an error. You should always check your error codes!
  356.  
  357. Standard Lingo Xtra Functions/Commands
  358. interface(xtra "XtraNet") -or- mMessageList(xtra "XtraNet")
  359. This function returns a short description of all of the functions and commands supported by XtraNet.
  360. put interface(xtra "XtraNet")
  361. -- XtraNet version 1.02
  362. -- Engineered by Brian Sharon
  363. -- Entire program code (C) 1996 Human Code, Inc.
  364. -- XtraNet (C) 1996 g/matter, inc.
  365. -- XtraNet is a registered trademark of Human Code, Inc. under license to g/matter, inc.
  366. -- All rights reserved.
  367. --
  368. -- For more information on XtraNet, see these websites:
  369. -- http://www.humancode.com
  370. -- http://www.gmatter.com
  371. --
  372. -- For technical support and sales, please email:
  373. -- <support@gmatter.com>
  374. -- <sales@gmatter.com>
  375. --
  376. -- Online help is available under the Xtras menu.
  377. --
  378. * XNetVersion
  379. * XNetInit *
  380. * XNetShutdown
  381. * XNetSetProxy *
  382. * XNetIPAddress
  383. * XNetDNSLookup string host
  384. * XNetSetDefaultTimeout integer timeOut
  385. * XNetGetDefaultTimeout
  386. * XNetSetTimeout integer cookie, integer timeOut
  387. * XNetGetTimeout integer cookie
  388. * XNetSetConnectionLoc any point
  389. * XNetSetConnectionMsg string msg
  390. * XNetError integer error
  391. * XNetGetFile string url, string file, string callback
  392. * XNetGetGlobal string url, string global, string callback
  393. * XNetPutFile string file, string url, string callback
  394. * XNetPutGlobal string global, string url, string callback
  395. * XNetSetCookie string cookie
  396. * XNetClearCookie
  397. * XNetIdle
  398. * XNetClose integer cookie
  399. * XNetPort integer cookie
  400. * XNetPeerCreate
  401. * XNetPeerConnect integer cookie, string host, integer port
  402. * XNetPeerAccept  integer cookie, integer port
  403. * XNetPeerGet integer cookie
  404. * XNetPeerSend integer cookie, string text
  405. * XNetClientCreate
  406. * XNetClientConnect integer cookie, string host, integer port
  407. * XNetClientAccept  integer cookie, integer port
  408. * XNetClientGet integer cookie
  409. * XNetClientSend integer cookie, string text
  410. * XNetServerStart integer maxClients, integer port, string callback
  411. * XNetServerSend integer cookie, string text, *
  412. * XNetServerDisconnect integer cookie, string name
  413. * XNetRawCreate
  414. * XNetRawConnect integer cookie, string host, integer port
  415. * XNetRawAccept  integer cookie, integer port
  416. * XNetRawGet integer cookie
  417. * XNetRawSend integer cookie, string text
  418. General
  419.  
  420. These are global level commands and functions which you will need to use to exercise the functionality of 
  421. XtraNet.  Primarily, these let you start and stop XtraNet and your network connection services.
  422. XNetInit
  423. This command initializes your XtraNet instance and starts up your networking connection.  You only 
  424. need to call this once per "session" to initialize your server or client experience.
  425. This command will initiate any network auto-connections through dialup Slip and PPP.  If the user 
  426. already has established a network connection it will be used.
  427. Example:
  428. XNetInit
  429. put XNetInit("XNET101-12345-67890") into resultCode
  430.  
  431. If you pass a serial number to XNetInit and you still get the "unregistered" dialog, your serial number 
  432. was input incorrectly.  Please check the number and correct it in your scripts.
  433. XNetIdle
  434. This command provides XtraNet with specific idle time to process your Server object and Data object 
  435. networking connections.  You will want to call this as often as necessary to keep up with the 
  436. networking demands of your application.  A common location for the XNetIdle call will be your on 
  437. idle handler or inside a frame script which loops on a frame.
  438. When you call XNetIdle, it checks each of your open network connections to determine if the operation 
  439. is complete and there is a pending callback request. Each connection is examined in a first-in first-out 
  440. sequence.  If a callback is pending, the callback is performed before checking any remaining open 
  441. connections for their status.  This can potentially result in substantial time being spent inside the 
  442. XNetIdle call.
  443. Note that this command is only necessary for XtraNet Servers and network operations which perform 
  444. callbacks into your code.  If you are using the Client, Peer or Raw mechanisms, you can control idle 
  445. time by using the appropriate "Get" command.  This provides an XtraNet client developer with 
  446. substantial control over how much time is spent processing the connection versus processing Lingo 
  447. code or other client side operations.
  448. Examples:
  449.  
  450. on idle
  451.   XNetIdle
  452. end idle
  453.  
  454. on exitFrame
  455.   XNetIdle
  456.   go to the frame
  457. end exitFrame
  458.  
  459.  
  460. See the section titled "Optimizing XtraNet Performance" for more details on the use of the XNetIdle 
  461. command. 
  462. XNetClose integer cookieID
  463. This command stops a specific networking operation which you have previously initiated and closes the 
  464. connection. This is specifically useful for cancelling Get or Put operations.
  465. Example:
  466. put XNetClose(cookieID) into cancelResultCode
  467. XNetShutdown
  468. This command stops your networking connection. Your instance of XtraNet will still be available and 
  469. you can re-initialize your networking connection using XNetInit.
  470. Example:
  471. on stopMovie
  472.   XNetShutdown
  473. end stopMovie
  474. XNetSetProxy string hostName, integer portAddress
  475. This command allows you to set up a proxy server.  To set up the proxy server, call XNetSetProxy 
  476. and provide the hostname and port address of the server.  XNetSetProxy provides support for CERN 
  477. proxies only.  To clear the proxy server, pass EMPTY as the argument
  478. Example:
  479. on setProxyServer
  480.   XNetSetProxy("proxy.gmatter.com", 4080) into proxyResult
  481.   return proxyResult
  482. end setProxyServer
  483. Informational
  484.  
  485. These functions provide useful XtraNet specific data to you.  You can determine which version of XtraNet is 
  486. running, the IP and domain names for the current machine and more.
  487. XNetVersion()
  488. This function returns the version of this copy of XtraNet as a string.
  489. Note:  You can compare this string against the version identifier located at the following URLs to 
  490. determine if you have the latest version of XtraNet:
  491. http://www.gmatter.com/xtras/xtranet/xtranetVersion.html
  492. Example:
  493. put XNetVersion() into xtraNetVersion
  494. put XNetVersion()
  495. -- "1.02"
  496.  
  497. XNetIPAddress()
  498. This function returns the IP address of the machine executing this copy of XtraNet as a string.
  499. Example:
  500. put XNetIPAddress() into resultCode
  501. -- "255.255.255.17"
  502. XNetPort(integer cookieID)
  503. This function returns the port address of the specified network operation (identified by its "cookie) as a 
  504. nunber.  If the cookieID is invalid, XtraNet will return a value of -1.
  505. Example:
  506. put XNetPort(cookieID) into portAddress
  507.  
  508. You can force the system to pick a unused port for you by passing 0 for the port number when using the 
  509. XNetRawAccept command.  You can then find out what the port number was by calling XNetPort 
  510. with the cookie returned by the XNetRawCreate command.
  511. XNetDNSLookup(string hostname|string IPaddress)
  512. This function returns the IP address of the domain specified by the string hostname.
  513. Failure to resolve to an IP address will return a string of "0.0.0.0"
  514. You can also perform a conversion of an IP address into a domain address.
  515. Failure to resolve to a domain name will return the IP address originally passed in as an argument.
  516. Example:
  517. put XNetDNSLookup("206.221.216.1") into hostIP
  518. put hostIP
  519. -- "www.gmatter.com"
  520. XNetError(integer errorCode)
  521. This function returns a string description of the error code provided.  If an unknown error code is 
  522. passed in, XtraNet will return "Unknown error".  All error codes are negative values except for an 
  523. error code of 0 which indicates no error.  See the Error Code table later in the documentation for more 
  524. details.
  525. Example:
  526. put XNetError(-29) into errorString
  527. alert "An XtraNet error occurred: "&&errorString
  528.  
  529. These commands provide control over the display of the Connecting to Host dialog which is 
  530. automatically displayed by XtraNet during long connections.  The purpose of the dialog is to keep the 
  531. user informed as to what is occurring when a connection takes longer than usual.
  532.  
  533. XNetSetConnectionLoc point upperLeftCornerofDialog
  534. This command sets the location of the Connecting to Host dialog which appears after the connection 
  535. timeout occurs.  The dialog will automatically appear after 5 seconds has elapsed and disappear after 
  536. 60 seconds.  This command is not available when using an unregistered version of XtraNet.
  537. Examples:
  538. XNetSetConnectionLoc point(0,0)
  539. XNetSetConnectionLoc point(320,240)
  540.  
  541. XtraNet checks to make sure that you have passed a valid point data argument.
  542. Note:  You can hide the dialog completely (not recommended) if you pass a point coordinate which if 
  543. off-screen.
  544. Example:
  545. XNetSetConnectionLoc point(-9999,-9999)
  546. XNetSetConnectionMsg string dialogText
  547. This command sets the display text of the Connecting to Host dialog which appears after the connection 
  548. timeout occurs. .  The dialog will automatically appear after 5 seconds has elapsed and disappear after 
  549. 60 seconds.  This command is not available when using an unregistered version of XtraNet.
  550. Examples:
  551. XNetSetConnectionMsg "Connecting to our super cool server...Please wait a moment!"
  552. XNetSetConnectionMsg field "ConnectionMsg"
  553.  
  554. Note:  You can set the display text back to the default by specifying an EMPTY string as the 
  555. argument.
  556. Example:
  557. XNetSetConnectionMsg ""
  558. Operation Timing
  559.  
  560. Use these features to control the automatic timeout mechanisms that will watch over your network connections.
  561. XNetSetDefaultTimeout integer timeOut
  562. This command specifies the default connection timeout value in seconds.  All subsequently opened 
  563. connections will use this timeout value unless the XNetSetTimeout command is used.
  564. Example:
  565. -- set the timeout to a full minute due to a slow server connection
  566. XNetSetDefaultTimeout(60)
  567.  
  568. XNetGetDefaultTimeout
  569. This function returns the current default connection timeout value as an integer representing seconds.  
  570. The default timeout value used in every XtraNet session is 30 seconds.  When a timeout occurs, the 
  571. network operation will return a result value of -29.
  572. Example:
  573. put XNetGetDefaultTimeout() into defaultTimeOutLength
  574. XNetSetTimeout integer cookie, integer timeOut
  575. This command specifies the connection timeout value in seconds for a specific connection.  Specifying 
  576. a value of 0 will turn off timeouts completely.  This is not recommended as it will essentially terminate 
  577. your network connections as soon as they begin since you will not be allowing for any connection 
  578. latency.  Unlike the XNetSetDefaultTimeout command, you can use this command to set the timeout 
  579. value for a connection already in progress.
  580. Example:
  581. XNetSetTimeout(gCookieID, 15)
  582. XNetGetTimeout integer cookie
  583. This function returns the current connection timeout value for a specific connection as an integer 
  584. representing seconds.
  585. Example:
  586. put XNetGetTimeout(gCookieID) into theTimeout
  587. Netscape-style Cookies
  588.  
  589. Use these commands to control Netscape-style cookies that you provide to your XtraNet applications. 
  590. Basically, a Netscape cookie is a piece of data that an HTTP server can return along with the page you asked 
  591. for.  The server is saying, "hold on to this data, and from now on, whenever you ask me for something, send 
  592. this data back to me".  So a server can use a cookie to do authentication, to track where you've been in a site, 
  593. to do shopping cart type applications, etc.
  594.  
  595. XtraNet doesn't really support cookies according to the official specification.  If the server returns a cookie, it 
  596. won't be saved by XtraNet (it's ignored, which is what you're supposed to do if you don't support cookies).  
  597.  
  598. Instead, XtraNet provides a modified form of cookie support which requires that you know the cookie in 
  599. advance of sending it.  You can provide the cookie information to XtraNet by using Javascript in a webpage 
  600. to get the cookie (document.cookie), then we pass that cookie into the Shockwave movie using XtraNet (using 
  601. parameters to the EMBED tag), and then passing the cookie on to the server from the client using the 
  602. XNetSetCookie command before making any server requests.
  603.  
  604. You can read more information about cookies at:
  605.  
  606. http://www.graphcomp.com/info/specs/nets/cookie.html
  607.  
  608.  
  609. XNetSetCookie string cookie
  610. This command specifies a string to be sent as the cookie for all future HTTP requests until the 
  611. XNetClearCookie command is executed or the application terminates. Cookie in this case refers to 
  612. Netscape's way of implementing persistent client-side states via HTTP, not cookie as the unique ID 
  613. number returned by many XtraNet calls.
  614. Example:
  615. -- set the timeout to a full minute due to a slow server connection
  616. XNetSetCookie "COOKIENAME=cookiedata"
  617. XNetClearCookie
  618. This function returns the current default connection timeout value as an integer representing seconds.  
  619. The default timeout value used in every XtraNet session is 30 seconds.  When a timeout occurs, the 
  620. network operation will return a result value of -29.
  621. Example:
  622. XNetClearCookie
  623.  
  624.  
  625. HTTP/FTP Access
  626.  
  627. These commands provide direct access to HTTP and FTP servers to both store and retrieve data.  These 
  628. XtraNet commands automatically determine whether you are perform HTTP or FTP operations and handle the 
  629. differences for you invisibly.  When addressing FTP servers, you can pass in username and password data to 
  630. establish connection to a secure server.
  631.  
  632. Example:
  633. put XNetGetGlobal("ftp://username:password@www.gmatter.com/private/specialdata.txt", "gSpecialData", 
  634. "processSpecialData") into getCookieID
  635. XNetGetFile string url, string filename, string callback
  636. This command gets a remote URL and stores its contents into a local file, using either FTP or HTTP. 
  637. When the operation finishes, the Lingo handler named "callback" will be notified. See "fetch.dir" for an 
  638. example.
  639. Example:
  640. put XNetGetFile("ftp://ftp.gmatter.com/pub/logo.pic", "gmatter.pic", "importLogo") into getCookieID
  641.  
  642. XNetGetFile can be used to perform CGI GET requests.  CGI POST is not currently supported.
  643. Example:
  644. put XNetGetFile("http://www.gmatter.com/cgi/mycgi?variable=data", "CGIData", "processCGIresults") into 
  645. getCookieID
  646. XNetGetGlobal string url, string globalname, string callback
  647. This command gets a remote URL and stores it into a global variable, using either FTP or HTTP. When 
  648. the operation finishes, the Lingo handler named "callback" will be notified. 
  649.  Example:
  650. put XNetGetGlobal("http://www.gmatter.com/homepage.html", "gURLData", "HTMLParse") into getCookieID
  651.  
  652. XNetGetGlobal can be used to perform CGI GET requests.  CGI POST is not currently supported. 
  653. Under Windows 3.1, you will only be able to retrieve 64K of data into a global variable at one time.
  654. Example:
  655. put XNetGetGlobal("http://www.gmatter.com/cgi/mycgi?variable=data", "gCGIData", "processCGIresults") into 
  656. getCookieID
  657. XNetPutFile string filename, string url, string callback
  658. This command takes a local file and stores it at a remote URL, using FTP. When the operation finishes, 
  659. the Lingo handler named "callback" will be notified. See "fetch.dir" for an example.
  660.  Example:
  661. put XNetPutFile(the pathname & "userData.txt", "ftp://ftp.gmatter.com/uploads/userdata.txt", "uploadComplete") into 
  662. putCookieID
  663.  
  664. XNetPutGlobal string globalname, string url, string callback
  665. This function takes a global variable and stores it at a remote URL, using FTP. When the operation 
  666. finishes, the Lingo handler named "callback" will be notified. See "fetch.dir" for an example.
  667. Example:
  668. put XNetPutGlobal("gFTPSendData", "ftp://ftp.gmatter.com/uploads/userdata.txt", "uploadComplete") into 
  669. putCookieID
  670. Peer Class
  671.  
  672. The Peer Class lets you create applications which bypass the unnecessary overhead involved in communicating 
  673. through an intermediary server.  You can even create a "ring" topology by using three or more peers to send 
  674. direct messages at very fast speeds across a network connection.
  675.  
  676. The Peer Class is useful for implementing "head to head" experiences or experiences with small groups (2-4).
  677. XNetPeerCreate
  678. This command creates a Peer object that can be used to connect directly to other Peers. "tictac.dir" 
  679. shows both modes. The comments in that file are pretty extensive as well. 
  680. Example:
  681. put XNetPeerCreate() into peerObjectCookieID
  682. XNetPeerConnect integer cookieID, string remoteHost, integer port
  683. This function connects a Peer object to a specified remote host at the specified port address.
  684. Example:
  685. put XNetPeerConnect(peerObjectCookieID, "hostname", 6000) into functionResult
  686. XNetPeerAccept integer cookieID, integer port
  687. This command accepts a connection, listening on the specified port. Port numbers should be > 1023 
  688. and < 32768 for peer-to-peer and client-server connections.
  689. Example:
  690. put XNetPeerAccept(peerObjectCookieID, 6000) into commandResult
  691. XNetPeerGet integer cookieID
  692. This function returns a line of text (1K maximum size) received through the specified connection.  If 
  693. there is no data ready to be retrieved, then an empty string ("") is returned.  If an error has occurred, 
  694. an error code will be returned.
  695. Example:
  696. put XNetPeerGet(peerObjectCookieID) into textLine
  697. XNetPeerSend integer cookieID, string theText
  698. This command send a line of text (1K maximum size) through the specified connection.
  699. Example:
  700. put XNetPeerSend(peerObjectCookieID, theText) into commandResult
  701.  
  702. Client Class
  703.  
  704. The Client Class lets you create client applications which use an intermediary server to communicate.  The 
  705. server acts to collate information from individual clients and then rebroadcast the necessary data to some or all 
  706. of the clients.
  707.  
  708. The Client Class is particularly useful for creating multi-player game experiences.
  709. XNetClientCreate
  710. This command creates a Client object that can be connected in a client-server architecture. "tictac.dir" 
  711. shows both modes. The comments in that file are pretty extensive as well. 
  712. Example:
  713. put XNetClientCreate() into clientObjectCookieID
  714. XNetClientConnect integer cookieID, string remoteHost, integer port
  715. This function connects a Client object to a specified remote host at the specified port address.
  716. Example:
  717. put XNetClientConnect(serverObjectCookieID, "hostname", 6000) into functionResult
  718. XNetClientAccept integer cookieID, integer port
  719. This command accepts a connection, listening on the specified port. Port numbers should be > 1023 
  720. and < 32768 for peer-to-peer and client-server connections.
  721. Example:
  722. put XNetClientAccept(serverObjectCookieID, 6000) into functionResult
  723. XNetClientGet integer cookieID
  724. This function returns a line of text (1K maximum size) received through the specified connection.  If 
  725. there is no data ready to be retrieved, then an empty string ("") is returned.  If an error has occurred, 
  726. an error code will be returned.
  727. Example:
  728. put XNetClientGet(serverObjectCookieID) into textLine
  729. XNetClientSend integer cookieID, string theText
  730. This command send a line of text (1K maximum size) through the specified connection.
  731. Example:
  732. put XNetClientSend(serverObjectCookieID, theText) into functionResult
  733.  
  734. Server Class
  735.  
  736. The Server Class lets you create server complements for your client applications.  The server acts to collate 
  737. information from individual clients and then rebroadcast the necessary data to some or all of the clients.
  738.  
  739. The Server Class is particularly useful for creating multi-player game experiences.
  740. XNetServerStart integer maxClients, integer port, string callback
  741. This function starts an XtraNet server that will accept clients.  Arguments allow you to specify how 
  742. many maximum connections will be allowed and which handler to execute as a callback when 
  743. connection events occur (i.e. connection made, connection terminated, etc.)  Calling this function 
  744. returns the cookieID associated with the specified port.
  745. Once a Server object has been created, the XNetIdle command will need to be called to provide 
  746. processing time for connection events.  See the XNetIdle command for more information.
  747. Example:
  748. put XNetServerStart(50, 6000, "serverStarted") into gServerCookieID
  749.  
  750. The number of active clients will be limited by the number of sockets that the machine can handle.  
  751. XtraNet current has a per XtraNet-based application process socket limit of 64.  You can use XtraNet 
  752. oriented Lingo code to determine your computer's socket limit (which may be less than XtraNet's):
  753. ...
  754. set err = 0
  755. set socketCount = 0
  756. XNetInit()
  757. repeat while err >= 0
  758.   set err = XNetGetGlobal("http://www.gmatter.com", "gNetText", "put")
  759.   if err > 0 then set socketCount = socketCount + 1
  760. end repeat
  761. XNetShutdown
  762. ...
  763. XNetServerSend integer cookieID, string theText [, string clientName]
  764. This command sends a line of text to either all clients or the specified list of clients.
  765. If clientName is not specified, the line of text will be sent to all clients. Otherwise you can pass the 
  766. internal username assigned to a client (which can be recorded when the client first connects by trapping 
  767. this information in the "serverCallback" handler.)  Only the specified client will receive the line of text.  
  768. If you want to send the text to a subset of all existing clients, you can use a list variable and process 
  769. each element inside of a repeat loop.  Note: see the "TTSERVER.DIR" example for more illustration 
  770. of this feature in use.
  771. Example:
  772. -- this sends the text to ALL clients
  773. XNetServerSend gCookieID, theText
  774.  
  775. -- this sends the text to a subset of clients
  776. put ["client1", "client3", "client7"] into clientNameList
  777. repeat with theClient in clientNameList
  778.   XNetServerSend gCookieID, theText, theClient
  779. end repeat
  780.  
  781. XNetServerDisconnect integer cookieID, string clientName
  782. This command disconnects the specified client.
  783. Example:
  784. put XNetServerDisconnect(gCookieID, theClient) into disconnectResult
  785. Raw Class
  786.  
  787. The Raw Class lets you use TCP/IP to communicate using nearly any protocol.  The data you send or receive 
  788. is not altered in any way, nor is any data header added to it.  For example, you can implement support for 
  789. SMTP protocol using Lingo and XtraNet's Raw commands (see the SMTP Client example for more details.)
  790. XNetRawCreate
  791. This function creates a Raw connection object and returns the socket id for the object.  You need to 
  792. create a connection object before using any of the other Raw class commands or functions.
  793. Example:
  794. set gMailSock = XNetRawCreate()
  795. XNetRawConnect integer cookie, string remoteHost, integer port
  796. This command establishes a connection with the remote host.  The host can be any type of server.
  797. Example:
  798. set mailhost = "gmatter.com" -- hardcoded port address for SMTP
  799. set mailport = 25 -- SMTP default
  800. put XNetRawConnect(gMailSock, mailhost, mailport) into XNRawResult
  801. XNetRawAccept integer cookie, integer port
  802. This command accepts a connection, listening on the specified port. Port numbers should be > 1023 
  803. and < 32768 for custom connections.  Be careful of conflicting with ports which may already be in 
  804. use.
  805. Example:
  806. set mailport = 2025 -- custom port address for a XtraNet-based SMTP mail server
  807. put XNetRawAccept(gMailSock, mailport)
  808. XNetRawGet integer cookie
  809. This function returns any pending data (up to 1024 bytes) being sent by a remote host through the 
  810. network connection identified by the cookie argument.  Only the exact data sent by the remote host 
  811. will be returned.
  812. Example:
  813. put string(XNetRawGet(gMailSock)) into receiverResponse
  814. XNetRawSend integer cookie, string theText
  815. This command allows you to send a string to the remote host connected through the connection 
  816. identified by the cookie argument.  The string can contain any data up to 1024 bytes.  Only the exact 
  817. data stored in the string is sent to the remote host.
  818. Example:
  819. put XNetRawSend(mailSocket, rawData) into XNetRawSendResult
  820.  
  821. XtraNet's CallBack Mechanism
  822. The Callback Parameter
  823. Several of XtraNet's commands allow specification of a custom handler to be called back when the operation 
  824. specified by that command has been completed.
  825.  
  826. The callback is used to allow XtraNet to send messages back to your application regarding the state of network 
  827. operations. It is used by the HTTP and FTP classes (which are created when you call XNetGetFile/ 
  828. XNetGetGlobal or XNetPutFile/ XNetPutGlobal), and by the XtraNet Server class (created with 
  829. XNetServerStart).
  830.  
  831. You can specify any Movie Script level handler for the callback.
  832.  
  833. Warning:  Do not try to use any XtraNet commands or functions inside a callback handler.  This is not 
  834. supported and will generate an XtraNet error result.  The only exception to this is the XNetError function 
  835. which can be used at any time.  If you need to make a call to an XtraNet command or function based on 
  836. callback data that has been received, you should set "flags" using global variables and then process those flags 
  837. in frame scripts.
  838. Creating a Callback Handler
  839. XtraNet operates asynchronously by sending messages into Director to execute a special handler which you 
  840. identify when initiating an asynchronous operation.  This is simply a Movie Script level will enable constant 
  841. processing of incoming connection information.
  842.  
  843. You can create as many different callback handlers as you may need in your project.  Every asynchronous 
  844. operation can have a different callback handler or they can all share the same handler.  Your application's 
  845. functionality will be determine the strategy you will want to apply.
  846.  
  847. Every callback handler is passed a data structure which identifies the status of the network operation.  In order 
  848. to access this data, your callback handler must specify an argument in which Director can hold the callback 
  849. handler data.  Here's an example:
  850.  
  851. on myCallbackHandler callBackData
  852.  -- your code here
  853. end myCallbackHandler
  854.  
  855. When you are specifying the callback handler with the XNetServerStart command, keep in mind that most 
  856. subsequent server operations will be processed through this callback handler.
  857. Structure of Callback Handler Data
  858. Your callback handlers will receive a data variable as and argument from XtraNet that has the following 
  859. structure: 
  860.  
  861. cookie    the unique identifier returned when the network operation was started
  862. major code    the type of operation (HTTP, FTP, etc.)
  863. minor code    the message (SUCCESS, ERROR, NEW_PLAYER, etc.)
  864. error    the last error code received
  865. optional    different messages can contain other, additional data 
  866. http code    special response data from HTTP servers
  867.  
  868. The message is sent to the callback handler as a property list. As mentioned above, there are five things that are 
  869. always put into the list: 
  870. Cookie
  871. The unique identifier for the network operation (which we've been calling a cookie). The property is #cookie, 
  872. the value is the id number returned from GetURL, PutFile/PutGlobal, or XNetServStart. 
  873. Major Code
  874. A number indicating the type of operation. This is referred to as the major code. The property is #major, the 
  875. possible values are: 
  876. 0 (HTTP)
  877. 1 (FTP)
  878. 2 (Server)
  879.  
  880. Other codes may be added later as new protocols are added. 
  881. Minor Code
  882. A number indicating the type of message being sent. This is referred to as the minor code. The property is 
  883. #minor, the possible values are: 
  884.  
  885. 0    XNET_SUCCESS
  886. 1    XNET_ERROR
  887. 2    XNET_STARTED
  888. 3    XNET_DESTROYED
  889. 4    XNET_CANCELLED
  890. 5    XNET_TEXT_MSG
  891. 8    XNET_NEW_PLAYER
  892. 9    XNET_PLAYER_LEAVE
  893.  
  894. For HTTP/FTP, the order of messages is like this:
  895.  
  896. XNET_STARTED - download/upload started successfully
  897. XNET_SUCCESS/XNET_ERROR - either we finished successfully, or we got an error
  898. XNET_DESTROYED - the instance was deleted, socket freed, etc.
  899.  
  900. If the user cancels the operation, the order will go like this:
  901.  
  902. XNET_STARTED - download/upload started successfully
  903. XNET_CANCEL - this operation was cancelled by calling XNetClose
  904. XNET_DESTROYED - the instance was deleted, socket freed, etc.
  905.  
  906. For HTTP or FTP, you're mainly interested in looking for XNET_SUCCESS and XNET_ERROR. If you're 
  907. using the server class, you're probably interested in a few more messages. Check out the Tic-Tac-Toe server 
  908. source code to see how it handles messages like XNET_TEXT_MSG, XNET_NEW_PLAYER, etc. 
  909. Optional Error Code
  910. The most recent error code. The property is #error, the possible values are the error codes listed here: 
  911. http://www.humancode.com/xtranet/errors.html . The value will always be 0, unless you get an 
  912. XNET_ERROR message. Alert readers may wonder why we bother to include it if it's always zero. I have no 
  913. good answer to that question.
  914.  
  915. HTTP Code
  916.  
  917. The property is #httpcode, the possible values are
  918.  
  919. 200 = success
  920. 204 = success but no data
  921. other value = HTTP result code
  922.  
  923. HTTP servers can generate an error and still return actual data due to redirection and other forms of server-side 
  924. error handling.  Therefore you cannot rely on examining the text returned from an HTTP server to determine 
  925. if the URL specified was appropriately retrieved.  Instead, you should examine the #httpcode property to see 
  926. if any value other than 200 was returned.  If a different value is returned, you can analyze it to decide what to 
  927. do next.
  928. Callback Data Debugging
  929. We recommend that you use Director's internal debugger and set a breakpoint inside your callback handler to 
  930. better observe the data structure passed in by XtraNet.  You may also wish to use the variable watcher 
  931. window. 
  932.  
  933. Another technique you can use is to specify the Lingo command "put" in place of a callback handler name.  
  934. This will cause the callback list to be passed as an argument to the put command and correspondingly dumped 
  935. into the Message window as the data arrives.  This is mostly useful to help get familiar with the structure and 
  936. contents of the callback data variable.
  937.  
  938. Note that the Client, Peer and Raw classes don't use a callback - instead, you just call the appropriate "Get" 
  939. command to check for data, and you either get a string back (if something's waiting), or you get an empty 
  940. string. It's a simpler programming model for complicated games (where having one catch-all handler doesn't 
  941. always work so well). It also has less overhead, and you get more control over how often you check for 
  942. messages (since the Client, Peer and Raw don't use XNetIdle to do any idle time processing). This makes it 
  943. more suited towards multi-player games.
  944.  
  945.  
  946. Optimizing XtraNet Performance
  947. There are many methods that can be used to optimize the performance of your XtraNet applications.  Writing 
  948. more efficient code, reducing memory management overhead, using more efficient media assets are all 
  949. examples of ways to optimize.  This chapter focuses on some of the more important techniques.
  950. Controlling Idle Time
  951. One of the most important optimization techniques is to focus on how the computer's noticeable "idle" time is 
  952. spent.  Idle time is simply the computer processing time which has not been previous allocated to other tasks.  
  953. This is time which you can arbitrarily use to instruct the computer to focus on specifically identified tasks.  
  954. Normally, Director uses idle time to send "idle" event messages to an executing Director movie.  The movie in 
  955. turn will process these event messages in a special handler called "on idle."
  956.  
  957. The on idle handler is often used to process code which needs to operate rapidly and continuously throughout a 
  958. project.  For example, the cursor position is often tracking during the on idle handler.
  959.  
  960. Many XtraNet operations are performed as asynchronous operations.  These are operations which are started 
  961. by XtraNet and sent to another computer.  While the remote computer is busy processing the requested 
  962. operation, XtraNet returns control back to Director so that other local operations can continue. 
  963.  
  964. At some point, XtraNet needs to check the status of the asynchronous operation it started to see whether it is 
  965. complete and what the result is.  To do this, XtraNet provides a special command called XNetIdle which 
  966. provides CPU time to XtraNet to specifically check the status of all of the existing asychronous operations.  
  967. Although you can execute the XNetIdle command at any time, one of the best times to do this is when you 
  968. know that there is available CPU time to spend performing this status checking task.  As a result, many 
  969. developers will choose to call the XNetIdle command from inside the on idle handler.
  970.  
  971. Example:
  972. on idle
  973.   XNetIdle
  974. end idle
  975.  
  976. Certain features in Director influence how frequently the idle event message is sent to a movie by Director and 
  977. overall how much idle time is made available.  Below you will find suggestions as to how these Director 
  978. features can be used to provide better performance to XtraNet.
  979.  
  980. Using Director's Idle Time Properties
  981. Director has a number of Lingo properties related to how idle time is processed which can impact XtraNet's 
  982. performance.  Specifically, the properties are:
  983.  
  984. the frameTempo
  985. the cpuHogTicks
  986. the idleHandlerPeriod
  987. the idleLoadMode
  988. the idleLoadPeriod
  989. the idleReadChunkSize
  990.  
  991. Let's review each property and discuss how they can be used in conjunction with XtraNet to gain maximum 
  992. performance.
  993.  
  994. the frameTempo -or- Tempo Channel
  995. The frameTempo property determines the frames per second that Director will attempt to limit the movement of 
  996. the playback to match.  This Lingo property is the same as the setting in the Tempo channel of Director's 
  997. Score interface.
  998.  
  999. The higher the frames per second setting, the fewer idle event messages that are sent to a movie by Director.  
  1000. This is because Director is attempting to execute the enterFrame handler, image the frame and then execute the 
  1001. exitFrame handler more and more frequuently as the tempo setting is increased.  The more time Director 
  1002. spends doing this, the less time is available for sending idle event messages to the movie.
  1003.  
  1004. So, to maximize the amount of idle messages and idle time that is available while looping on a frame or running 
  1005. the playback head through a series of frame, you should set the Tempo channel or the frameTempo property to 
  1006. a value of 1.
  1007. the cpuHogTicks
  1008.  
  1009. Set this property to 0 to give background OS tasks more CPU allocation.  The default value is 20.
  1010. Set this property to a higher value to shutdown OS tasks.
  1011.  
  1012. This property only applies to Macintosh and Windows 16-bit.  Windows 32-bit uses threads and this property 
  1013. only affects the performance of the thread running Director and XtraNet.
  1014. the idleHandlerPeriod
  1015.  
  1016. To generate the maximum potential number of idle event messages, set this property to a value of 0 (the 
  1017. default).  To force more CPU time to be spent performing other operations and to generate the fewest idle 
  1018. event messages, set this property to a value of the maxInteger (2147483647).
  1019. the idleLoadMode
  1020.  
  1021. To maximize the amount of idle time that can be spend processing the XNetIdle command, set this property to 
  1022. a value of 0.  To create more balance between data loading and XNetIdle command execution, set this 
  1023. property to a value of 1, 2 or 3 (the default.)
  1024. the idleLoadPeriod
  1025.  
  1026. If the idleLoadMode property is set to 0, you do not need to set this property.  Otherwise, set this property to 
  1027. a higher value (up to the maxInteger) to force more time to be made available for XNetIdle command execution 
  1028. and less time for idle time data loading.
  1029. the idleReadChunkSize
  1030.  
  1031. Set this property to a lower number to create more granularity between XNetIdle command execution and idle 
  1032. time data loading.  The smaller the data chunk size, the more interruptable the data loading process is.  The 
  1033. default chunk size is 32K.  You probably don't want to make the chunk size much smaller than 512 or 1,204 
  1034. bytes.
  1035.  
  1036. Sustaining Connections
  1037. Normally, when you are using a web browser to access a HTTP server, a connection is opened for each data 
  1038. element being retrieved from the server to deliver a complete HTML document.  If the data contained 
  1039. embedded references to images, for example, each image is delivered by first opening a separate connection to 
  1040. the server, having the server feed the data stream for the image, and then having that connection closed.
  1041.  
  1042. Opening and closing server connections takes noticeably CPU time.  If you are creating an XtraNet 
  1043. application which needs to repeated send or receive data from a remote server, you will find that you can get 
  1044. better performance by keeping the connection open on a sustained basis and reusing that connection for future 
  1045. network operations.
  1046.  
  1047. Normally, XtraNet will leave a connection open causing a typical XtraNet application to look like this:
  1048.  
  1049. XNetConnect
  1050. XNetGet or XNetSend
  1051. XNetGet or XNetSend
  1052. XNetGet or XNetSend
  1053. XNetGet or XNetSend
  1054. ...
  1055. XNetClose
  1056.  
  1057. The main reason to take the alternative approach of closing the connection immediately after moving the data 
  1058. through is if you want to avoid using too many connections.  The Macintosh and Windows operating systems 
  1059. have limits as to how many connections you can have active simultaneously.  XtraNet itself is limited to 64 
  1060. connections which is the same as the Macintosh OS limit.
  1061.  
  1062. If you take this approach to managing your network operations, your code might look like this:
  1063.  
  1064. XNetConnect
  1065. XNetGet or XNetSend
  1066. XNetClose
  1067. XNetConnect
  1068. XNetGet or XNetSend
  1069. XNetClose
  1070. XNetConnect
  1071. XNetGet or XNetSend
  1072. XNetClose
  1073. ....
  1074.  
  1075.  
  1076. Credits
  1077.  
  1078. XtraNet was created by Human Code, Inc. of Austin, Texas, USA and is exclusively published by g/matter, inc. 
  1079. of San Francisco, California, USA.
  1080. Human Code, Inc.
  1081.  
  1082. XtraNet Contributors
  1083.  
  1084. Concept Design
  1085.     Chipp Walters
  1086.  
  1087. Programming and Implementation
  1088.     Brian Sharon
  1089.  
  1090. Prototype Programming
  1091.     Scott Thompson
  1092.  
  1093. Thanks to Human Coders:
  1094.     Chris Bohnert
  1095.     Mary Flanagan
  1096.     Gary Gattis
  1097.     Carl Shephard
  1098.     Cindy Taylor
  1099.     Masayoshi Umeuchi
  1100.     Lloyd Walker
  1101.  
  1102. Special Thanks
  1103.  
  1104.     Macintosh socket library based on GUSI (C)1992-1996, Matthias Neeracher, 
  1105. http://www.iis.ee.ethz.ch/~neeri.
  1106.     Tim Jones
  1107.     Rick Ligas
  1108.     Macromedia
  1109.  
  1110. for their inspiration and encouragement early on.
  1111.  
  1112. Get the most recent information about Human Code, Inc. at their website:   
  1113. http://www.humancode.com
  1114.  
  1115.  
  1116. g/matter, inc.
  1117.  
  1118. g/matter, inc. is the leading publisher of information and tools for mastering multimedia. Established in 1992, 
  1119. we have been responsible for the development of over 70 CD-ROM titles.  Since 1994 we have been creating 
  1120. a large number of add-on products for Macromedia software, including:
  1121.  
  1122. XtraNet Contributors
  1123.  
  1124. Examples and Documentation
  1125.     Terry R. Schussler
  1126.  
  1127. Packaging and Art
  1128.     David Gartner
  1129.  
  1130. Thanks to g/matterians:
  1131.     Lisa Carroll
  1132.     Nick Cavander
  1133.     Skip Knierim
  1134.     David Kraus
  1135.     Seth Luersen
  1136.     Mary Lowry
  1137.     Chris Mikkelsen
  1138.     Karyn Scott
  1139.     Stacey Scott
  1140.  
  1141. Go to our website for the latest information on all of our multimedia products:  
  1142. http://www.gmatter.com
  1143.  
  1144.  
  1145. Other g/matter Products
  1146. PrintOMatic Xtra
  1147. PrintOMatic is the premier printing tool for Director. The PrintOMatic Xtra adds a full set of page-layout, text 
  1148. and graphics printing features to Macromedia Director projects on Macintosh and Windows. PrintOMatic 
  1149. includes commands for drawing styled text, graphic primitives, bitmapped pictures, and snapshots of the 
  1150. Director stage, all under Lingo control
  1151. PopMenu Xtra
  1152. PopMenu Xtra adds tools for enhancing your Macromedia Director user interfaces, including pop-up and 
  1153. multi-level heirarchical menus. 
  1154. Sound Xtra 
  1155. Sound Xtra adds powerful new sound recording and playback control to your Macromedia Director 
  1156. productions.With Sound Xtra, you can control the use of sound using features which are not available in Lingo 
  1157. or with other Xobjects.
  1158. KILLER Transitions 
  1159. Killer Transitions contains special effects which can be used in your Macromedia Director 5.x and Authorware 
  1160. 3.5 productions to add new visual transitions to your display.  Each of the Killer Transitions effects has many 
  1161. powerful settings which can be used to alter the effect to create literally thousands of transition results.
  1162. Trans-X Xtra
  1163. Trans-X Xtra lets you create your own transition effects by creating animated 1-bit masks and then applying 
  1164. those as a transition. Trans-X ships with over 100 pre-rendered masks to get you started!
  1165. Director ToolBox Pro
  1166. Director ToolBox Pro contains a powerful suite of development aids for users of Macromedia Director, 
  1167. including cast, score sprite and Lingo analysis, debugging, formatting and management tools which make it 
  1168. easier and faster to produce complete, solid results.
  1169. The MediaBook CD for Director
  1170. The MediaBook CD for Director is the definitive collection of information and tools for users of Macromedia 
  1171. Director 3, 4 and 5. Learn everything about the Lingo programming language! The MediaBook CD helps you 
  1172. leverage your investment and enrich your use of Director. Professional and novice multimedia producers will 
  1173. save time and money by using the royalty free programming, numerous XObjects for Macintosh and Windows 
  1174. and reuseable, professionally written Lingo provided in The MediaBook CD.
  1175.  
  1176. g/matter, inc. also teaches a series of very advanced multimedia development seminars focused on Director, 
  1177. Media Production and Internet development all over the world.  Contact us for information on the next 
  1178. seminar near you!
  1179.  
  1180. Go to our website for the latest information on all of our multimedia products:  
  1181. http://www.gmatter.com
  1182.  
  1183. How To Contact Us
  1184.  
  1185. If you have technical support questions about using XtraNet, please contact us at:
  1186.  
  1187. Email:  support@gmatter.com
  1188. Fax:  +1-415-243-0396
  1189. Web:  http://www.gmatter.com
  1190.  
  1191. If you have suggestions for future features or other products please send email to g/matter, inc at:
  1192.  
  1193. ideas@gmatter.com
  1194.  
  1195. or send us a facsimile at: +1.415.243.0396
  1196. Copyright Notices
  1197.  
  1198. Programming ゥ 1995-1997 Human Code, Inc.  All rights reserved.
  1199. Documentation and sample movies ゥ 1995-1997 g/matter, inc.  All rights reserved.
  1200. XtraNet is a registered trademark of Human Code, Inc. under exclusive license to g/matter, inc.
  1201.  
  1202. g/matter, MediaBook and The MediaBook CD are registered trademarks and PopMenu Xtra, PrintOMatic 
  1203. Xtra, Sound Xtra, Director ToolBox Pro are trademarks of g/matter, inc. KILLER Transitions is a registered 
  1204. trademark of SharkByte Tools, Inc.  SharkByte is a registered trademark of Terry Ranson.  Macromedia, 
  1205. Authorware and Director are registered trademarks and Shockwave is a trademark of Macromedia, Inc.  
  1206. Other product names mentioned within this documentation may be trademarks or registered trademarks of 
  1207. other companies.
  1208.  
  1209. Appendix A - Error Messages and Codes
  1210. This is a list of result (error) code values, along with their definitions.  You can use the XNetError function to 
  1211. convert an error code value into a human-readable string for a given error.
  1212.  
  1213. Code    Error String    Error Description
  1214.  
  1215. 0    "Success"    Congratulations. Whatever you were trying to do, 
  1216. you did it right.
  1217.  
  1218. -1    "DNS lookup failure"    DNS (Domain Name Service) failure. We were 
  1219. unable to convert a host name (like 
  1220. www.humancode.com) into an address (like 
  1221. 204.96.160.69). This can indicate many things: a 
  1222. misspelled address, a broken network connection, or 
  1223. the DNS at your service provider may actually be 
  1224. down (the last one happens to me more than I'd like!).
  1225.  
  1226. -2    "Failure to create socket"    We were unable to allocate a network connection. 
  1227. The usual cause of this error is being out of memory. 
  1228. Try increasing your Director, runtime projector or 
  1229. internet browser memory partition if you're using a 
  1230. Macintosh.
  1231.  
  1232. -3    "This socket is not connected"    Something tried to send or receive data over a 
  1233. connection that was already closed. Note that the 
  1234. other end can close the connection without notifying 
  1235. you.
  1236.  
  1237. -4    "Error connecting to remote host"    A common error, with many possible causes. Your 
  1238. network connection can be down. And at the remote 
  1239. end, the computer might be off, not connected to the 
  1240. network, or not listening for connections. The best 
  1241. interpretation of this message is "the remote host is 
  1242. not responding".
  1243.  
  1244. -5     "Error closing socket"    An informational error, that there was some problem 
  1245. closing a connection. If there was some data waiting 
  1246. to be delivered, it probably didn't make it. But once 
  1247. the close call has been made there's not much you can 
  1248. do, so you might as well ignore this one.
  1249.  
  1250. -6    "Error setting socket options"    An error occurred whiling changing socket attributes. 
  1251. Can (theoretically) arise in the connection process. 
  1252. Never seen this one actually happen, don't know what 
  1253. could cause it, but if you get this error, the connection 
  1254. is toast.
  1255.  
  1256. -7    "Error binding socket to given port value"    You asked a server, peer or client to start listening on 
  1257. a specific port, and the system was unable to grant 
  1258. that request. The best way to get that error would be 
  1259. to try to listen on a port that another program is 
  1260. already listening on. If you're running a web server, 
  1261. and then you try to start an XtraNet server listening 
  1262. on port 80, you'll get an error because the web server 
  1263. bound to port 80 before you did.
  1264.  
  1265.  
  1266. Code    Error String    Error Description
  1267.  
  1268. -8    "Socket unable to listen"    We tried to listen for connections on a specified port, 
  1269. but failed. If you get this error, it'll probably be for the 
  1270. same reason that you would get a "socket creation 
  1271. failure" error: out of memory.
  1272.  
  1273. -9    "The remote end has closed the connection"    You tried to do something with the connection, but 
  1274. the other end had closed it down (which they're 
  1275. perfectly entitled to do). Note that if the remote end 
  1276. loses their network connection unexpectedly (like if 
  1277. their modem drops the signal), they won't have a 
  1278. chance to properly close the connection, and you 
  1279. won't receive a remote close message. You have to 
  1280. decide when a person is disconnected based on 
  1281. inactivity. Just wanted to emphasize that.
  1282.  
  1283. -10    "Error reading from network"    You can get this error when reading from a network 
  1284. socket.
  1285.  
  1286. -11    "Error writing to network"    Like a read error, you can get this error when writing 
  1287. to a socket (just about any XtraNet command).
  1288.  
  1289. -12    "Bad argument passed to function"    Right now, that means that you passed in a string that 
  1290. couldn't be converted to a global variable name.
  1291.  
  1292. -13    "Invalid URL passed to function"    Double-check your spelling. Make sure the path 
  1293. you're referencing really exists. Make sure (for FTP) 
  1294. that you have permission to read or write the specified 
  1295. URL. Note that XtraNet will accept the syntax 
  1296. ftp://user:pass@host for non-anonymous FTP.
  1297.  
  1298. -14    "Error opening file"    Couldn't open the file on your hard disk that you're 
  1299. trying to FTP out of or into. Causes: misspelling, not 
  1300. specifying a full path, no permission to 
  1301. read/create/overwrite the specified file.
  1302.  
  1303. -15    "The socket is already connected"    You tried to connect somewhere, when that peer 
  1304. object was already connected to another machine. 
  1305. The current connection is preserved. To close a 
  1306. connection and open another, call XNetCancel() 
  1307. before calling XNetPeerConnect().
  1308.  
  1309. -16    "Cannot perform requested operation with given protocol"    
  1310.         An attempt to use an unsupported protocol occurred. 
  1311. Returned if you try to use XNetPutFile or 
  1312. XNetPutGlobal with an http URL (since HTTP 1.0 
  1313. doesn't support uploading, only downloading), or if 
  1314. you specify an unrecognized URL (like mailto: or 
  1315. gopher:). Check your spelling!
  1316.  
  1317.  
  1318. Code    Error String    Error Description
  1319.  
  1320. -17    "Out of memory"    Pretty self-explanatory. XtraNet allocates some 
  1321. memory (about 1K) dynamically for each connection 
  1322. you create. If you're starting a bunch of HTTP 
  1323. downloads at the same time, try to control how many 
  1324. connections you open at once.
  1325.  
  1326. -18    "Network initialization failed"    Returned by XNetInit() if it fail. You can't do 
  1327. anything else with XtraNet if this call fails. Many 
  1328. possible causes - the network can break in many 
  1329. places, as all Internet users know! Check modem 
  1330. cables, network cables, network software settings.
  1331.  
  1332. -19    "There is no job with that identifier"    You passed in an invalid identifier when referencing a 
  1333. connection. This code snippet would return this error 
  1334. to you really quick:
  1335.  
  1336. set cookie = XtraNetGetURL("http://www.humancode.com", "gNetText", "callback")
  1337. set cookie = cookie + 1
  1338. set err = XtraNetCancel(cookie)
  1339.  
  1340.         Guard those cookie values with your life!
  1341.  
  1342. -20    "Name already taken"    Obsolete.
  1343.  
  1344. -21    "The server is full"    You tried to connect to an XtraNet server, but they 
  1345. had no room for you. Don't take it personally.
  1346.  
  1347. -22    "The requested operation cannot be perfomed on this connection"
  1348.         Job type mismatch. You passed in a valid identifier for 
  1349. some connection, but it doesn't match up with the 
  1350. function you're calling. A code snippet:
  1351.  
  1352. -- get a cookie for an HTTP download
  1353. set cookie = XtraNetGetURL("http://www.humancode.com", "gNetText", "callback")
  1354. -- then pass that cookie to a peer function
  1355. set err = XtraNetHCPPeerSendLine(cookie)
  1356.  
  1357.         Important note for Windows 3.1 developers: you 
  1358. won't get this error - you'll crash instead! The reason 
  1359. is due to the nature of C++ and the limitations of 
  1360. Visual C++ for Windows 3.1.
  1361.  
  1362. -23    "Command failed"    Obsolete.
  1363.  
  1364. -24    "Connection refused"    You tried to connect to a host, but the host wasn't 
  1365. listening at the port you wanted.
  1366.  
  1367. -25    "Insufficient permission for requested operation"
  1368.         Your HTTP or FTP request required authentication 
  1369. and the server responded by informing you that you 
  1370. did not have the correct permission.
  1371.  
  1372. Code    Error String    Error Description
  1373.  
  1374. -26    "Server error"    You should not see this error.  If you do, please 
  1375. report it to XTRANET@GMATTER.COM.  Thank 
  1376. you.
  1377.  
  1378. -27    "There is no user with that name"    You tried to use XNetServerSend to send a message 
  1379. to a specific user, but that user doesn't exist.
  1380.  
  1381. -28    "XtraNet has not been initialized"    XtraNet not initialized. Returned if you try to start a 
  1382. connection without having called XtraNetInit 
  1383. successfully.
  1384.  
  1385. -29    "Timeout waiting for response"    We were waiting for a response from an FTP or 
  1386. HTTP server, but it didn't arrive within the given time. 
  1387. You can use various XtraNet commands to get and 
  1388. set the default timeout, and to get and set timeouts on 
  1389. a individual connection basis.
  1390.  
  1391. -30    "Error reading from file"    You can get this error when reading from a local file 
  1392. via the XtraNetPutFile command.  You were able to 
  1393. open the file but unable to read from it.  Some sort 
  1394. of disk error occurred when you tried.
  1395.  
  1396. -31    "Error writing to file"     You can get this error both when writing to a remote 
  1397. file via the XtraNetGetFile command.  The disk is 
  1398. probably full or you encountered some sort of disk 
  1399. error.
  1400.  
  1401. -32    "Unable to call XtraNet method from an XtraNet callback handler"
  1402.          You are making calls to XtraNet functions or 
  1403. commands from within a handler which has been 
  1404. specified as a callback handler.  This limitation 
  1405. prevents inadvertent recursion and data corruption.  
  1406. You can however call the XNetError function from 
  1407. within the callback handler.
  1408.  
  1409. -33    "Message too long (1 kb max)"     You tried to send a text variable which is larger than 
  1410. 1K (1,024 bytes) in length/size.
  1411.  
  1412. -34    "Director internal error"     You should not see this error.  If you do, please 
  1413. report it to XTRANET@GMATTER.COM.  Thank 
  1414. you.
  1415.  
  1416. -35    "File i/o unavailable in Shockwave"     You have attempted to use an XtraNet Get command 
  1417. while specifying a filename which is either not ISO 
  1418. 9660 compliant or has a filename extension which is 
  1419. not allowed.  See the Shockwave Security Issues 
  1420. section of the documentation for a list of disallowed 
  1421. extensions.
  1422.  
  1423. -36    "Shockwave security error - invalid file type"     You attempted to use the Get or Put commands while 
  1424. in Shockwave in a manner which is not supported by 
  1425. XtraNet.  See the Appendix titled "XtraNet Security 
  1426. in Shockwave" for more details.
  1427.  
  1428.  
  1429. Code    Error String    Error Description
  1430.  
  1431. -37    "Feature not available in unregistered XtraNet"     You attempted to use the SetConnectionMsg and 
  1432. SetConnectionLoc commands without registering 
  1433. XtraNet using the XNetInit command.  These 
  1434. features are disabled until XtraNet is registered.
  1435.  
  1436. -38    "Invalid FTP user name"     You attempted to access an FTP server using a 
  1437. username which is not known by the server.
  1438.  
  1439. -39    "Invalid FTP password"     You attempted to access an FTP server using a 
  1440. password which is incorrect.
  1441.  
  1442. -40    "Invalid FTP directory"     You attempted to access an FTP server directory 
  1443. which either doesn't exist or you do not have 
  1444. permission to access.
  1445.  
  1446. -41    "Invalid FTP filename"    You attempted to access an FTP server file which 
  1447. either doesn't exist or you do not have permission to 
  1448. access.
  1449.  
  1450. -42    "Unknown error"     Some generic XtraNet error has occurred.
  1451.  
  1452.  
  1453. Appendix B - Memory Overhead Chart
  1454.  
  1455. XtraNet consumes a small amount of additional memory.  This table gives you a rough idea of how much 
  1456. based on the user's playback system.  You can use the freeBytes property in Lingo to further analyze memory 
  1457. consumption over time.
  1458. Macintosh 68K
  1459. Base XtraNet Memory Usage:  About 200K
  1460.  
  1461. Per Connection Memory Usage:  About 2K
  1462. Macintosh PPC
  1463. Base XtraNet Memory Usage:  About 86K
  1464.  
  1465. Per Connection Memory Usage:  About 2K
  1466.  
  1467. Note that all of the code can be swapped out of memory when virtual memory is enabled.
  1468. Windows 16-bit
  1469. Base XtraNet Memory Usage:  About 97K
  1470.  
  1471. Per Connection Memory Usage:  About 2K
  1472. Windows 32-bit
  1473. Base XtraNet Memory Usage:  About 180K
  1474.  
  1475. Per Connection Memory Usage:  About 2K
  1476.  
  1477. Appendix C - Shockwave Security Issues
  1478.  
  1479. XtraNet has some security limits which are active only when executing XtraNet through a Shockwave movie.  
  1480. This limits are designed to prevent accidental or malicious use while leaving developers free to flexibly create 
  1481. exciting applications.  Here's an overview of the security minded limitations in XtraNet:
  1482. ISO Compliant Filenames
  1483. XtraNet limits you to use of ISO 9660 (8.3) compatible filenames when using the Get commands.  This means 
  1484. you cannot use other than alphanumeric characters in your filename references.
  1485. Invalid Filename Extensions
  1486. XtraNet will refuse to accept filenames with certain extensions when using the Get commands.  This prevents 
  1487. the accidental overwriting of system files and other critical files which involve the proper operation of the 
  1488. computer.  The extensions which are not allowed are:
  1489.  
  1490.  
  1491. .386
  1492. .3gr
  1493. .acm
  1494. .acv
  1495. .bin
  1496. .cfg
  1497. .cpl
  1498. .csp
  1499. .d32
  1500. .dbg
  1501. .dll
  1502. .drv
  1503. .exe
  1504. .fon
  1505. .gid
  1506. .hlp
  1507. .inf
  1508. .ini
  1509. .kbd
  1510. .lic
  1511. .lnk
  1512. .pdb
  1513. .prf
  1514. .map
  1515. .mfm
  1516. .mod
  1517. .nls
  1518. .ocx
  1519. .olb
  1520. .q32
  1521. .qtc
  1522. .rat
  1523. .reg
  1524. .rsr
  1525. .sig
  1526. .spd
  1527. .sym
  1528. .tlb
  1529. .trn
  1530. .tsk
  1531. .tsp
  1532. .upd
  1533. .vbx
  1534. .vxd
  1535. .w95
  1536. .x16
  1537. .x32
  1538.  
  1539.  
  1540.  
  1541. Appendix D - FTP Connection Process in XtraNet
  1542.  
  1543. This is an overview of the process that XtraNet uses which performing an FTP network operation.
  1544.  
  1545. 1) Check for XtraNet initialization.
  1546.     Can return "Network not initialized"
  1547.  
  1548. 2) Read the arguments passed to the XtraNet command.
  1549.     Can return "Director error" if there is something wrong with the arguments.
  1550.  
  1551. 3) Parse the URL. 
  1552.     Can return "Bad url"
  1553.     XtraNet now matches the URL data to the protocol request.
  1554.  
  1555. 4) Create the connection object.
  1556.     Can return "Out of memory" but memory would have to be really low.
  1557.  
  1558. 5) Open the network connection.
  1559.     Can return "DNS fail" or "Connect fail"
  1560.  
  1561. 6) Login to the server
  1562.     Can return "Bad user", "Bad password", or "Server error"
  1563.     "bad user" if both are bad.
  1564.     "server error" is variable as to cause
  1565.  
  1566. 7) Switch to binary mode.
  1567.     Can return "Server error"
  1568.  
  1569. 8) Change to the directory specified in the URL
  1570.     Can return "Bad directory" or "Server error"
  1571.  
  1572. This can occur because an attempt to change the directory on the server was to an out of bounds place 
  1573. (missing permission, doesn't exist)
  1574.  
  1575. 9) Start another socket to receive the data on
  1576.     Can return "Socket create fail"
  1577.     The socket is a randomly selected free one.
  1578.  
  1579. 10) Tell the FTP server which socket to connect to on our end
  1580.     Can return "Server error" because the server can't connect to socket.
  1581.  
  1582. 11) Send the put or get command
  1583.     Can return "Bad file" or "Server error"
  1584.  
  1585. 12) If we make it past all of these steps, then we return "success" and a valid cookie
  1586. value.
  1587.  
  1588. Appendix E - Additional References and Resources
  1589.  
  1590. WWW Resources
  1591.  
  1592. Download the latest version of XtraNet, its documentation and examples at:
  1593.  
  1594. http://www.gmatter.com/download/xtranet.html
  1595.  
  1596. View on-line examples of XtraNet in action using Shockwave at:
  1597.  
  1598. http://www.gmatter.com/products/xtranet/xtranetshowcase.html
  1599.  
  1600. WWW References
  1601.  
  1602. You can read more information about Cookies at:
  1603.  
  1604. http://www.graphcomp.com/info/specs/nets/cookie.html
  1605.  
  1606. You can read more information about TELNET (RFC 854) at:
  1607.  
  1608. http://www.graphcomp.com/info/rfc/rfc0854.html
  1609.  
  1610. If you're interested in learning how to implement attachments in a mail application using Xtranet, you will want 
  1611. to read the MIME specification (RFC 1521).  The specification can be found at:
  1612.  
  1613. http://www.graphcomp.com/info/rfc/rfc1521.html
  1614.  
  1615. Book References
  1616. "Internet Protocols Handbook"
  1617. by Dave Roberts
  1618.  
  1619. Published by Coriolis Group Books
  1620. ISBN 1-883577-88-8
  1621.  
  1622. Covers a ton of protocols, including SMTP, POP3, GOPHER, NNTP and TELNET and it has a CD-ROM 
  1623. with all of the current status data on each protocol.
  1624.  
  1625. Appendix F - URL Encoding
  1626. Example #1
  1627. -- Functions to encode illegal characters in a URL as per RFC 1738
  1628. -- See http://www.graphcomp.com/info/rfc/rfc1738.html for details
  1629. -- 
  1630. -- Author: Brian Sharon, brians@humancode.com
  1631.  
  1632. on encodeURL url
  1633.   set badList = [" ", "<", ">", QUOTE, "{", "}", "|", "・", "^", "[",
  1634. "]", "'"]
  1635.   set newURL = ""
  1636.   repeat with i = 1 to the number of chars in url
  1637.     set tChar = char i of url
  1638.     set tNum = charToNum(tChar)
  1639.     if getOne(badList, tChar) or tNum < 32 or tNum = 127 then
  1640.       -- this is an unsafe character, and has
  1641.       -- to be encoded.  Encoding is a percent sign followed by
  1642.       -- the number in hex
  1643.       set tChar = "%" & numToHex(tNum)
  1644.     end if
  1645.     set newURL = newURL & tChar
  1646.   end repeat
  1647.   return newURL
  1648. end encodeURL
  1649.  
  1650. on numToHex num
  1651.   -- assumes number is between 0 and 255
  1652.   set num1 = num/16
  1653.   set num2 = num - num1*16
  1654.   case num1 of
  1655.     10: set num1 = "A"
  1656.     11: set num1 = "B"
  1657.     12: set num1 = "C"
  1658.     13: set num1 = "D"
  1659.     14: set num1 = "E"
  1660.     15: set num1 = "F"
  1661.     otherwise
  1662.       set num1 = string(num1)
  1663.   end case
  1664.   case num2 of
  1665.     10: set num2 = "A"
  1666.     11: set num2 = "B"
  1667.     12: set num2 = "C"
  1668.     13: set num2 = "D"
  1669.     14: set num2 = "E"
  1670.     15: set num2 = "F"
  1671.     otherwise
  1672.       set num2 = string(num2)
  1673.   end case
  1674.   return num1 & num2
  1675. end numToHex
  1676.  
  1677. And here's some examples of the code in use:
  1678.  
  1679. put encodeurl("http://www.humancode.com")
  1680. -- "http://www.humancode.com"
  1681. put encodeurl("http://www.humancode.com/directory with spaces/[index.html]")
  1682. -- "http://www.humancode.com/directory%20with%20spaces/%5Bindex.html%5D"
  1683. Example #2
  1684. on encodeURL oldString
  1685.   --| This encodes the passed text to a format that is good for the
  1686.   --| location line in any Browser
  1687.   --| First written: 96-12-09 Patrik Oskarsson <patrik.oskarsson@shine.se>
  1688.  
  1689.   if length( oldString ) < 1 then exit -- Exit if the string is empty
  1690.  
  1691.   set newString = ""
  1692.   repeat with foo = 1 to length( oldString )
  1693.     set currChar to char foo of oldString
  1694.     case currChar of
  1695.       TAB : set currChar = "%09"
  1696.       "~" : set currChar = "%7E"
  1697.       ">" : set currChar = "%3E"
  1698.       "・" : set currChar = "%5C"
  1699.       "^" : set currChar = "%5E"
  1700.       "{" : set currChar = "%7B"
  1701.       "}" : set currChar = "%7D"
  1702.       "<" : set currChar = "%3C"
  1703.       "[" : set currChar = "%5B"
  1704.       "]" : set currChar = "%5D"
  1705.       "`" : set currChar = "%60"
  1706.       "|" : set currChar = "%7C"
  1707.       " " : set currChar = "+"
  1708.       "/" : set currChar = "%2F"
  1709.       "#" : set currChar = "%23"
  1710.       "?" : set currChar = "%3f"
  1711.       "%" : set currChar = "%25"
  1712.       otherwise
  1713.         nothing
  1714.     end case
  1715.     set newString = newString & currChar
  1716.   end repeat
  1717.  
  1718.   return newString
  1719.  
  1720. end encodeURL
  1721. XtraNet Documentation    g/matter, inc.    Version 1.02
  1722.         
  1723.  
  1724.  
  1725.         
  1726.     Page -1-
  1727.  
  1728.  
  1729.